﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 一起来击键
{
    public partial class 数码测试结果窗体 : Form
    {
       
            public 数码测试结果窗体(int user_input_nums, string[] shuzu, string[] shuzu2, int sudu_, int time_)
        {
            InitializeComponent();
            // int page = 1;
            int chengji = 0;
            // label1.Text = user_input_nums.ToString();

            string cuo_daan = "", cuo_qing = "";
            int correct = 0, worng = 0;
            string cuo_daan_ = "", cuo_qing_ = "";
            for (int page = 1; page <= 5; page++)
            {
                string a = "", b = "";
                try
                {
                    a = shuzu[page].Replace(" ", "").Replace("\n", "");
                    b = shuzu2[page].Replace(" ", "").Replace("\n", "");
                }

                catch (Exception)
                {
                   
                }

                for (int i = 0; i < b.Length; i = i + 4)
                {
                    try
                    {
                        if (a.Substring(i, 4) == b.Substring(i, 4))
                            correct = correct + 1;
                        else
                        {
                            worng = worng + 1;
                            cuo_daan = cuo_daan + a.Substring(i, 4);
                            cuo_qing = cuo_qing + b.Substring(i, 4);
                        }
                    }
                    catch (Exception)
                    {
                       
                    }


                }
            }
            if (worng == 0)
                chengji = sudu_;
            else if (correct / worng >= 150)
                chengji = sudu_;
            else
            {
                if (correct - worng * 150 >= 0)
                    chengji = (int)correct / time_ * 60;
                else chengji = 0;
            }
            label6.Text = (correct + worng).ToString();
            label7.Text = worng.ToString();
            label8.Text = time_.ToString();
            label9.Text = sudu_.ToString();
            label10.Text = chengji.ToString();

            cuo_daan_ = cuo_daan_ + "正确：";
            cuo_qing_ = cuo_qing_ + "错误：";
            for (int i = 0; i < cuo_daan.Length; i = i + 4)
            {
                cuo_daan_ = cuo_daan_ + cuo_daan.Substring(i, 4) + " ";
                cuo_qing_ = cuo_qing_ + cuo_qing.Substring(i, 4) + " ";
            }

            textBox1.Text = cuo_daan_;
            textBox2.Text = cuo_qing_;

            if (chengji < 220)
                label13.Text = "不合格";
            else if (chengji < 250)
                label13.Text = "合格";
            else if (chengji < 270)
                label13.Text = "一般";
            else if (chengji < 300)
                label13.Text = "良好";
            else if (chengji < 350)
                label13.Text = "优秀";
            else if (chengji >= 350)
                label13.Text = "满分";

        }


        private void 测试结果窗体_Load(object sender, EventArgs e)
        {

        }

    }
}
